package cj.web.sc.dao;
/*
 *  
 *  
*/
import java.util.List;
import java.util.Map;

import net.paoding.rose.jade.annotation.DAO;
import net.paoding.rose.jade.annotation.SQL;
import net.paoding.rose.jade.annotation.SQLParam;
import cj.web.sc.domain.SCPropertyValue;

/**
 * 
 * @author 
 *
 */
@DAO
public interface SCPropertyValueDAO{
    @SQL("select * from SCPropertyValue where id=:1")
    SCPropertyValue queryById(int id);
    
    @SQL("INSERT INTO SCPropertyValue (propertyId,categoryId,name,image,sort,deleteFlag,createUser,createAt,updateUser,updateAt) VALUES (:t.propertyId,:t.categoryId,:t.name,:t.image,:t.sort,:t.deleteFlag,:t.createUser,NOW(),:t.updateUser,NOW())")
    void create(@SQLParam("t") SCPropertyValue sCPropertyValue);
	
	@SQL("UPDATE SCPropertyValue SET name=:t.name,image=:t.image,sort=:t.sort,updateUser=:t.updateUser,updateAt=NOW() WHERE id=:t.id")
    void update(@SQLParam("t") SCPropertyValue sCPropertyValue);
    
    @SQL("UPDATE SCPropertyValue SET deleteFlag=0,updateUser=:t.updateUser,updateAt=NOW() WHERE id=:t.id")
    void deleteById(@SQLParam("t") SCPropertyValue propertyValue);

    @SQL("select * from SCPropertyValue where deleteFlag=1 and propertyId=:t.propertyId ORDER BY sort LIMIT :t.start,:t.length")
	List<SCPropertyValue> queryByPropertyId(@SQLParam("t")SCPropertyValue propertyValue);

    @SQL("select count(1) from SCPropertyValue where deleteFlag=1 and propertyId=:t.propertyId")
	int sizeByPropertyId(@SQLParam("t")SCPropertyValue propertyValue);

    @SQL("select id,name from SCPropertyValue where deleteFlag=1 and propertyId=:1 order by sort")
	List<Map> queryByPropertyId(int propertyId);
}